<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title><?php echo siteInfo('sitename');?></title>
  <link rel="stylesheet" href="<?php echo U_RES;?>/lib/layui/css/layui.css">
  <link rel="stylesheet" href="<?php echo U_RES_APP;?>/css/main.css">
</head>

<body>
  <div class="layui-layout layui-layout-admin">
    <div class="layui-header">
      <a href="javascript:;" onclick="loadMenu('<{CAUrl('index','index')}>&menu=menu_index')"><div class="layui-logo layui-hide-xs cxuu-logo"><?php echo siteInfo('sitename');?></div></a>
      <ul class="layui-nav layui-layout-left">
        <!-- 移动端显示 
      <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
        <span title="左侧菜单显隐" id="leftMenuCtrl"><i class="layui-icon" aria-hidden="true"></i></span>
      </li>-->
        <li title="左侧菜单显隐" id="leftMenuCtrl" class="layui-nav-item cxuu_leftmenuctrl"><i class="layui-icon" aria-hidden="true"></i></li> 
        <?php if(SysRolCk("contentcate_index")){ ?>
        <li class="layui-nav-item" title="内容管理"><a href="javascript:;" onclick="loadMenu('<{CAUrl('index','index')}>&menu=menu_content')"><i class="layui-icon layui-icon-list" style="font-size: 22px;"></i></a></li>
        <?php } if(SysRolCk("system_menu")){ ?>
        <li class="layui-nav-item" title="系统设置"><a href="javascript:;" onclick="loadMenu('<{CAUrl('index','index')}>&menu=menu_system')"><i class="layui-icon layui-icon-set-fill" style="font-size: 22px;"></i></a></li>
        <?php } if(SysRolCk("function_menu")){ ?>
          <li class="layui-nav-item" title="内置功能"><a href="javascript:;" onclick="loadMenu('<{CAUrl('index','index')}>&menu=menu_extend')"><i class="layui-icon layui-icon-app" style="font-size: 22px;"></i></a></li>
        <?php } ?>
      </ul>
    </div>
<!-- 左侧导航 -->
    <div class="layui-side layui-bg-black cxuu-menu-left ">
      <div class="layui-side-scroll" id="leftMenu">
      </div>
    </div>
<!-- 内容主体区域 -->
    <div class="layui-body">
      <div id="main" style="padding: 5px;"></div>
    </div>
    <!-- 底部固定区域 -->
    <div class="layui-footer">
      © cxuu.top - <?php echo siteInfo('sitename');?>
    </div>
  </div>
  <script src="<?php echo U_RES;?>/lib/jquery-1.11.3.min.js"></script>
  <script src="<?php echo U_RES;?>/lib/layui/layui.js?v=2.8.rc5"></script>
  <script src="<?php echo U_RES;?>/lib/lay-config.js?v=1.0.1" charset="utf-8"></script>
  
  <script>
    layui.define(function () {
      var element = layui.element,layer = layui.layer,$ = layui.jquery;
    });


    $("#main").load('<{CAUrl("index","index")}>&menu=home');
    $("#leftMenu").load('<{CAUrl("index","index")}>&menu=menu_index');

    function loadMain(url) {
     $("#main").load(url);
    }

    //左侧菜单控制
    var isShow = true;
    //初始化后台时，隐藏左栏
	  // if(isShow){
    //   leftMenuHide();
    // };
    function loadMenu(url) {
      $("#leftMenu").load(url);
      if(!isShow){
          leftMenuShow();
        }
    }

    //左侧菜单隐藏控制
    $('#leftMenuCtrl i').addClass('layui-icon-shrink-right');
    $('#leftMenuCtrl').click(function(){
        if(isShow){
          leftMenuHide();
        }else{
          leftMenuShow();
        }
    });
    function leftMenuHide(){
        $('.layui-side.layui-bg-black').width(0); //设置宽度
        $('#leftMenuCtrl i').toggleClass('layui-icon-spread-left');
        $(".layui-layout-admin").toggleClass("showMenu");
        $('#leftContent').hide();
        isShow =false;
    }
    function leftMenuShow(){
        $('.layui-side.layui-bg-black').width(200);
        $('#leftMenuCtrl i').toggleClass('layui-icon-spread-left');
        $(".layui-layout-admin").toggleClass("showMenu");
        $('#leftContent').show();
        isShow =true;
    }

    //防止页面后退
    history.pushState(null, null, document.URL);
    window.addEventListener('popstate', function () {
      history.pushState(null, null, document.URL);
    });
  </script>
</body>

</html>